package com.lh.item.api;

import com.lh.common.pojo.PageResult;
import com.lh.item.bo.SpuBo;
import com.lh.item.pojo.SkuDo;
import com.lh.item.pojo.SpuDetailDo;
import com.lh.item.pojo.SpuDo;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商品相关api，用于开放给外部module使用
 *
 * @author liuhe
 * @date 2020/06/24
 */
@RequestMapping("goods")
public interface GoodsApi {
    /**
     * 获取商品列表
     */
    @GetMapping("spu/page")
    PageResult<SpuBo> querySpuList(@RequestParam(value = "page", defaultValue = "0") Integer page,
                                   @RequestParam(value = "rows", defaultValue = "10") Integer rows,
                                   @RequestParam(value = "key", required = false) String key,
                                   @RequestParam(value = "saleable", required = false) Boolean saleable);

    /**
     * 根据spuId查询详情信息
     */
    @GetMapping("spu/detail/{spuId}")
    SpuDetailDo querySpuDetailBySpuId(@PathVariable(value = "spuId") Long spuId);

    /**
     * 根据spuId查询其下所有的sku
     */
    @GetMapping("/sku/list/{spuId}")
    List<SkuDo> querySkuListBySpuId(@PathVariable(value = "spuId") Long spuId);

    /**
     * 根据spuId查询spu基本信息
     *
     * @param spuId
     * @return
     */
    @GetMapping("/spu/{spuId}")
    SpuBo querySpuById(@PathVariable(value = "spuId") Long spuId);
}
